import Vue from 'vue'
import Router from 'vue-router'
// import api from '@/api'
// import store from '@/store'
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/key'
    },
    {
      path: '/',
      name: 'Home',
      component: () => import('@/pages/home'),
      children: [
        {
          path: 'key',
          name: 'key',
          component: () => import('@/pages/keywordSearch'),
          beforeEnter (to, from, next) {
            next()
          }
        },
        {
          path: 'quiz',
          name: 'quiz',
          component: () => import('@/pages/knowledgeQuiz')
        },
        {
          path: 'learn',
          name: 'learn',
          component: () => import('@/pages/standardLearning')
        },
        {
          path: 'card',
          name: 'card',
          component: () => import('@/pages/knowledgeCard')
        },
        {
          path: 'exam',
          name: 'exam',
          component: () => import('@/pages/safetyExam')
        }
      ]
    },
    {
      path: '/*',
      redirect: '/key'
    }
  ]
})
